Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vue-demi

Package Overview
Dependencies
Maintainers
1
Versions
88
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-demi

  • 0.4.5
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4.1M
decreased by-6.02%
Maintainers
1
Weekly downloads
 
Created

What is vue-demi?

The vue-demi package is a utility that enables library authors to publish their libraries for both Vue 2 and Vue 3 with a single codebase. It provides a set of APIs that are compatible with both versions of Vue, allowing for seamless integration and use in projects that may be using either version.

What are vue-demi's main functionalities?

Unified Vue Hooks

vue-demi provides a way to detect the version of Vue being used and allows you to conditionally execute code based on the version. This is useful for handling differences in the Vue lifecycle hooks or other version-specific features.

import { isVue2, isVue3, Vue2, Vue3 } from 'vue-demi'

if (isVue2) {
  // Vue 2 specific logic
} else if (isVue3) {
  // Vue 3 specific logic
}

Reactive API

vue-demi exports the reactive composition API that is consistent across Vue 2 and Vue 3. This allows developers to use the reactive system without worrying about the underlying Vue version.

import { ref, reactive } from 'vue-demi'

const count = ref(0)
const state = reactive({ name: 'Vue' })

Effect API

vue-demi provides the effect function which is part of the reactivity system in Vue 3 and is made available for Vue 2 through this package. It allows you to run side effects when reactive data changes.

import { effect } from 'vue-demi'

effect(() => {
  console.log('This will run when reactive state changes')
})

Other packages similar to vue-demi

FAQs

Package last updated on 20 Nov 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc